package com.design.pattern;

/**
 * @author TW
 */
public class BridgePattern {
    public static void main(String[] args){
        CircleBridge circleBridge = new CircleBridge(2,4,8, new RedCircle());
        circleBridge.draw();
    }
}

interface DrawAPI{
    public void drawCircle(int radius, int x, int y);
}

class RedCircle implements DrawAPI{

    @Override
    public void drawCircle(int radius, int x, int y) {
        System.out.println("Drawing Circle[ color: red, radius: "
                + radius +", x: " +x+", "+ y +"]");
    }
}
class GreenCircle implements DrawAPI{
    @Override
    public void drawCircle(int radius, int x, int y) {
        System.out.println("Drawing Circle[ color: green, radius: "
                + radius +", x: " +x+", "+ y +"]");
    }
}


abstract class ShapeBridge{
    public DrawAPI drawAPI;

    public ShapeBridge(DrawAPI drawAPI){
        this.drawAPI = drawAPI;
    }
    public abstract void draw();
}

class CircleBridge extends  ShapeBridge{
    private int x,y,radius;
    public CircleBridge(int x, int y, int radius, DrawAPI drawAPI) {
        super(drawAPI);
        this.x = x;
        this.y = y;
        this.radius = radius;
    }

    @Override
    public void draw() {
        drawAPI.drawCircle(radius,x,y);
    }
}